$("#seller_name").select2({
    ajax: {
        url: "../../../wxapp/seller/getListByName",
        dataType: 'json',
        delay: 250,
        data: function (params) {
            return {
                name: params.term
            };
        },
        processResults: function (data, params) {
            params.page = params.page || 1;
            var newdata = $.map(data.sellerList.obj, function (obj) {
                obj.id = obj.id || obj.rowId; // replace pk with your identifier
                obj.text =  obj.name||"";
                return obj;
            });

            return {
                results: newdata,
                pagination: {
                    more: (params.page * 30) < data.total_count
                }
            };
        },
        cache: true
    },
    escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
    minimumInputLength: 1
});
